package com.leo.entity;

import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "user")
public class User {
	private String appURL;
	private String oid;
	private String password;
	private String queryRight = "no";
	private List<StuUid> stuUids = new LinkedList<StuUid>();
	private String username;

	@Column(length=100)
	public String getAppURL() {
		return appURL;
	}

	@Id
	@Column(length = 36, unique = true)
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
	public String getOid() {
		return oid;
	}

	@Column(length = 30,nullable=false)
	public String getPassword() {
		return password;
	}

	@Column(length = 5,columnDefinition="varchar(5) default 'no'",nullable=false)
	public String getQueryRight() {
		return queryRight;
	}

	@OneToMany(mappedBy="user",fetch=FetchType.LAZY)
	public List<StuUid> getStuUids() {
		return stuUids;
	}
	
	@Column(length = 30,unique = true,nullable=false)
	public String getUsername() {
		return username;
	}
	
	public void setAppURL(String appURL) {
		this.appURL = appURL;
	}
	
	public void setOid(String oid) {
		this.oid = oid;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	public void setQueryRight(String queryRight) {
		this.queryRight = queryRight;
	}
	
	public void setStuUids(List<StuUid> stuUids) {
		this.stuUids = stuUids;
	}
	
	public void setUsername(String username) {
		this.username = username;
	}
	
}
